package pl.s7n.paint.commands;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.Line2D;

import pl.s7n.paint.utils.SelfUpdatable;

/**
 * Erase Tool command. <br>
 * the color is always white.<br>
 * Usually the shape is a complex path of a mouse move.<br>
 * But when no movement is done, the shape has to be updated to form a line (1px).
 * 
 * @author 7
 */
public class EraserStrokeCmd extends AbstractDrawStrokeCmd implements SelfUpdatable {

  @Override
  public void update() {
    if (shape.getBounds().isEmpty()) {
      shape = new Line2D.Float(start, start);
    }
  }

  @Override
  public void draw(Graphics2D g) {
    tool.setColor(Color.WHITE);
    super.draw(g);
  }

  @Override
  public String toString() {
    return "eraser";
  }

}
